package com.gopay.common.domain.cust;

import com.gopay.common.cipher.utils.SensitiveInfoUtils;
import com.gopay.common.domain.BaseEntity;

import javax.persistence.*;
import java.util.Date;

/**
 * 提现银行绑定关系表 The persistent class for the BAS_BATCH_PAY_ORDER_DTL database
 * table.
 */
@Entity
@Table(name = "CUST_BANK_ACCT_INFO")
public class CustBankAcctInfo extends BaseEntity {

    private static final long serialVersionUID = -1633458906480141509L;

    private Long infoSq;
    private String custId;
    private String custName;
    private String acctAlias;
    private String bankCode;
    private String bankName;
    private String bankProvinceCode;
    private String bankProvinceName;
    private String bankCityCode;
    private String bankCityName;
    private String bankBranchName;
    private String bankBranchCode;
    private String bankAcctNum;
    private int delFlag;
    private int firstChoice;
    private Date createdTs;
    private Date lastUpdTs;
    private String lastUpdTrancode;
    /**
     * 银行预留手机号 add by jiaoshuai 20161228
     */
    private String bankReservationMob;
    /**
     * 账户类型 add by pansc 20180419
     */
    private String acctType;
    /**
     * 对公对私标识 add by pansc 20180419
     */
    private String bcFlag;

    @Id
    @Column(name = "INFO_SQ")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "CUST_BANK_ACCT_INFO_SEQ")
    @SequenceGenerator(name = "CUST_BANK_ACCT_INFO_SEQ", allocationSize = 1, initialValue = 1, sequenceName = "CUST_BANK_ACCT_INFO_SEQ")
    public Long getInfoSq() {
        return this.infoSq;
    }

    public void setInfoSq(Long infoSq) {
        this.infoSq = infoSq;
    }

    @Column(name = "CUST_ID", nullable = false, length = 10)
    public String getCustId() {
        return this.custId;
    }

    public void setCustId(String custId) {
        this.custId = custId;
    }

    @Column(name = "CUST_NAME", nullable = false, length = 150)
    public String getCustName() {
        /**
    	 * modify by zyt，2017-2-22 在程序中获取的时候进行解密操作，如果是hibernate自己调用（save等），则返回原值；
    	 */
    	this.custName = SensitiveInfoUtils.autoReencrypt(this.custName);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.custName);
    }

    public void setCustName(String custName) {
        /**
    	 * modified by zyt，2017-2-22 判断传入字符串是否经过加密，如果是，则设置为原文，否则设置为加密后的值
    	 */
    	this.custName = SensitiveInfoUtils.smartEncryptWithCheck(custName);
    }

    @Column(name = "ACCT_ALIAS", nullable = false, length = 150)
    public String getAcctAlias() {
        /**
    	 * modify by zyt，2017-2-22 在程序中获取的时候进行解密操作，如果是hibernate自己调用（save等），则返回原值；
    	 */
    	this.acctAlias = SensitiveInfoUtils.autoReencrypt(this.acctAlias);
    	return SensitiveInfoUtils.smartDecryptWithCheck(this.acctAlias);
    }

    public void setAcctAlias(String acctAlias) {
        /**
    	 * modified by zyt，2017-2-22 判断传入字符串是否经过加密，如果是，则设置为原文，否则设置为加密后的值
    	 */
    	this.acctAlias = SensitiveInfoUtils.smartEncryptWithCheck(acctAlias);
    }

    @Column(name = "BANK_CODE", nullable = false, length = 10)
    public String getBankCode() {
        return this.bankCode;
    }

    public void setBankCode(String bankCode) {
        this.bankCode = bankCode;
    }

    @Column(name = "BANK_NAME", length = 50)
    public String getBankName() {
        return this.bankName;
    }

    public void setBankName(String bankName) {
        this.bankName = bankName;
    }

    @Column(name = "BANK_PROVINCE_CODE", length = 20)
    public String getBankProvinceCode() {
        return this.bankProvinceCode;
    }

    public void setBankProvinceCode(String bankProvinceCode) {
        this.bankProvinceCode = bankProvinceCode;
    }

    @Column(name = "BANK_PROVINCE_NAME", length = 50)
    public String getBankProvinceName() {
        return this.bankProvinceName;
    }

    public void setBankProvinceName(String bankProvinceName) {
        this.bankProvinceName = bankProvinceName;
    }

    @Column(name = "BANK_CITY_CODE", length = 20)
    public String getBankCityCode() {
        return this.bankCityCode;
    }

    public void setBankCityCode(String bankCityCode) {
        this.bankCityCode = bankCityCode;
    }

    @Column(name = "BANK_CITY_NAME", length = 50)
    public String getBankCityName() {
        return this.bankCityName;
    }

    public void setBankCityName(String bankCityName) {
        this.bankCityName = bankCityName;
    }

    @Column(name = "BANK_BRANCH_NAME", length = 200)
    public String getBankBranchName() {
        return this.bankBranchName;
    }

    public void setBankBranchName(String bankBranchName) {
        this.bankBranchName = bankBranchName;
    }

    @Column(name = "BANK_BRANCH_CODE", length = 20)
    public String getBankBranchCode() {
        return this.bankBranchCode;
    }

    public void setBankBranchCode(String bankBranchCode) {
        this.bankBranchCode = bankBranchCode;
    }

    @Column(name = "BANK_ACCT_NUM", length = 150)
    public String getBankAcctNum() {
        /**
    	 * modify by zyt，2017-2-22 在程序中获取的时候进行解密操作，如果是hibernate自己调用（save等），则返回原值；
    	 */
    	this.bankAcctNum = SensitiveInfoUtils.autoReencrypt(this.bankAcctNum);
        return  SensitiveInfoUtils.smartDecryptWithCheck(this.bankAcctNum);
    }

    public void setBankAcctNum(String bankAcctNum) {
        /**
    	 * modified by zyt，2017-2-22 判断传入字符串是否经过加密，如果是，则设置为原文，否则设置为加密后的值
    	 */
        this.bankAcctNum = SensitiveInfoUtils.smartEncryptWithCheck(bankAcctNum);
    }

    @Column(name = "DEL_FLAG", nullable = false, precision = 22, scale = 0)
    public int getDelFlag() {
        return this.delFlag;
    }

    public void setDelFlag(int delFlag) {
        this.delFlag = delFlag;
    }

    @Column(name = "FIRST_CHOICE", nullable = false)
    public int getFirstChoice() {
        return firstChoice;
    }

    public void setFirstChoice(int firstChoice) {
        this.firstChoice = firstChoice;
    }

    @Column(name = "CREATED_TS", nullable = false)
    public Date getCreatedTs() {
        return this.createdTs;
    }

    public void setCreatedTs(Date createdTs) {
        this.createdTs = createdTs;
    }

    @Column(name = "LAST_UPD_TS", nullable = false)
    public Date getLastUpdTs() {
        return this.lastUpdTs;
    }

    public void setLastUpdTs(Date lastUpdTs) {
        this.lastUpdTs = lastUpdTs;
    }

    @Column(name = "LAST_UPD_TRANCODE", length = 10)
    public String getLastUpdTrancode() {
        return this.lastUpdTrancode;
    }

    public void setLastUpdTrancode(String lastUpdTrancode) {
        this.lastUpdTrancode = lastUpdTrancode;
    }

    @Column(name = "BANK_RESERVATION_MOB", length = 150)
    public String getBankReservationMob() {
        //return bankReservationMob;
        /**
         * modified by zyt 2017-4-10 自动重新加密并解密返回
         */
        this.bankReservationMob = SensitiveInfoUtils.autoReencrypt(this.bankReservationMob);
        return SensitiveInfoUtils.smartDecryptWithCheck(this.bankReservationMob);
    }

    public void setBankReservationMob(String bankReservationMob) {
        //this.bankReservationMob = bankReservationMob;
        /**
         * modified by zyt 2017-4-10 写操作的时候做加密
         */
        this.bankReservationMob = SensitiveInfoUtils.smartEncryptWithCheck(bankReservationMob);
    }
    @Column(name="ACCT_TYPE")
    public String getAcctType() {
        return acctType;
    }

    public void setAcctType(String acctType) {
        this.acctType = acctType;
    }
    @Column(name="BC_FLAG")
    public String getBcFlag() {
        return bcFlag;
    }

    public void setBcFlag(String bcFlag) {
        this.bcFlag = bcFlag;
    }
}
